import java.awt.desktop.SystemEventListener;
import java.util.Scanner;
import static java.lang.System.in;

public class Demo12 {
    public static volatile int n = 0;
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
            while(n == 0){

            }
            System.out.println("n的值修改成功");
        });
        Thread t2 = new Thread(()->{
            Scanner scanner  =  new Scanner(in);
            System.out.println("请输入一个整数");
            n = scanner.nextInt();
        });
        t1.start();
        t2.start();
        t1.join();
        t2.join();
    }
}
